home *** CD-ROM | disk | FTP | other *** search
/ Risc World 5 / Risc World 5.iso / SOFTWARE / Issue3 / Games / xrick / !xrick / src / c / scr_imain < prev    next >
Text File  |  2004-06-24  |  3KB  |  165 lines

  1. /*
  2.  * xrick/src/scr_imain.c
  3.  *
  4.  * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
  5.  *
  6.  * The use and distribution terms for this software are contained in the file
  7.  * named README, which can be found in the root of this distribution. By
  8.  * using this software in any fashion, you are agreeing to be bound by the
  9.  * terms of this license.
  10.  *
  11.  * You must not remove this notice, or any other, from this software.
  12.  */
  13.  
  14. #include <stdio.h>  /* sprintf */
  15.  
  16. #include "system.h"
  17. #include "game.h"
  18. #include "screens.h"
  19.  
  20. #include "draw.h"
  21. #include "pics.h"
  22. #include "control.h"
  23.  
  24. /*
  25.  * Main introduction
  26.  *
  27.  * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT
  28.  */
  29. U8
  30. screen_introMain(void)
  31. {
  32.   static U8 seq = 0;
  33.   static U8 seen = 0;
  34.   static U8 first = TRUE;
  35.   static U8 period = 0;
  36.   static U32 tm = 0;
  37.     U8 i, s[32];
  38.  
  39.   if (seq == 0) {
  40.     draw_tilesBank = 0;
  41.     if (first == TRUE)
  42.       seq = 1;
  43.     else
  44.       seq = 4;
  45.     period = game_period;
  46.     game_period = 50;
  47.     game_rects = &draw_SCREENRECT;
  48. #ifdef ENABLE_SOUND
  49.     game_setmusic("sounds/tune5.wav", -1);
  50. #endif
  51.   }
  52.  
  53.   switch (seq) {
  54.   case 1:  /* dispay hall of fame */
  55.     sysvid_clear();
  56.     tm = sys_gettime();
  57.  
  58. #ifdef GFXPC
  59.     /* Rick Dangerous title */
  60.     draw_tllst = (U8 *)screen_imainrdt;
  61.     draw_setfb(32, 16);
  62.     draw_filter = 0xaaaa;
  63.     draw_tilesList();
  64.  
  65.     /* Core Design copyright + press space to start */
  66.     draw_tllst = (U8 *)screen_imaincdc;
  67.     draw_setfb(64, 80);
  68.     draw_filter = 0x5555;
  69.     draw_tilesList();
  70. #endif
  71.  
  72. #ifdef GFXST
  73.     draw_pic(0, 0, 0x140, 0xc8, pic_splash);
  74. #endif
  75.  
  76.     seq = 2;
  77.     break;
  78.  
  79.   case 2:  /* wait for key pressed or timeout */
  80.     if (control_status & CONTROL_FIRE)
  81.       seq = 3;
  82.     else if (sys_gettime() - tm > SCREEN_TIMEOUT) {
  83.       seen++;
  84.       seq = 4;
  85.     }
  86.     break;
  87.  
  88.   case 3:  /* wait for key released */
  89.     if (!(control_status & CONTROL_FIRE)) {
  90.       if (seen++ == 0)
  91.     seq = 4;
  92.       else
  93.     seq = 7;
  94.     }
  95.     break;
  96.  
  97.   case 4:  /* display Rick Dangerous title and Core Design copyright */
  98.     sysvid_clear();
  99.     tm = sys_gettime();
  100.  
  101.     /* hall of fame title */
  102. #ifdef GFXPC
  103.     draw_tllst = (U8 *)screen_imainhoft;
  104.     draw_setfb(32, 0);
  105.     draw_filter = 0xaaaa;
  106.     draw_tilesList();
  107. #endif
  108. #ifdef GFXST
  109.     draw_pic(0, 0, 0x140, 0x20, pic_haf);
  110. #endif
  111.  
  112.     /* hall of fame content */
  113.     draw_setfb(56, 40);
  114. #ifdef GFXPC
  115.     draw_filter = 0x5555;
  116. #endif
  117.     for (i = 0; i < 8; i++) {
  118.       sprintf((char *)s, "%06d@@@....@@@%s",
  119.           game_hscores[i].score, game_hscores[i].name);
  120.       s[26] = '\377'; s[27] = '\377'; s[28] = '\376';
  121.       draw_tllst = s;
  122.       draw_tilesList();
  123.     }
  124.  
  125.     seq = 5;
  126.     break;
  127.  
  128.   case 5:  /* wait for key pressed or timeout */
  129.     if (control_status & CONTROL_FIRE)
  130.       seq = 6;
  131.     else if (sys_gettime() - tm > SCREEN_TIMEOUT) {
  132.       seen++;
  133.       seq = 1;
  134.     }
  135.     break;
  136.  
  137.   case 6:  /* wait for key released */
  138.     if (!(control_status & CONTROL_FIRE)) {
  139.       if (seen++ == 0)
  140.     seq = 1;
  141.       else
  142.     seq = 7;
  143.     }
  144.     break;
  145.   }
  146.  
  147.   if (control_status & CONTROL_EXIT)  /* check for exit request */
  148.     return SCREEN_EXIT;
  149.  
  150.   if (seq == 7) {  /* we're done */
  151.     sysvid_clear();
  152.     seq = 0;
  153.     seen = 0;
  154.     first = FALSE;
  155.     game_period = period;
  156.     return SCREEN_DONE;
  157.   }
  158.   else
  159.     return SCREEN_RUNNING;
  160. }
  161.  
  162. /* eof */
  163.  
  164.  
  165.